package com.tianruan.dc.modules.sys.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tianruan.dc.modules.sys.user.entity.Work;
import com.tianruan.dc.modules.sys.user.entity.WorkInfo;
import org.apache.ibatis.annotations.Select;

/**
 * Author: Vivienne
 */
public interface WorkInfoMapper extends BaseMapper<WorkInfo> {

    /**
     * 通过id获得username和workid在workinfo表
     * @param id
     * @return
     */
    @Select("select username, work_id from work_info where id = #{id}")
    WorkInfo getUsernameAndWorkid(String id);


    /**
     * 通过username和workid获取title
     * @param username
     * @param workId
     * @return
     */
    @Select("select tile from work where username = #{username} and work_id = #{workId}")
    String getTitle(String username, String workId);

    @Select("select * from work_info where username = #{username} and work_id = #{workId}")
    WorkInfo selectInfo(String username,String workId);
}
